//每个数字类czl
cc.Class({
    extends: cc.Component,
    //七个火柴棍czl
    properties: {
        HuoChaiBang0: cc.Node,
        HuoChaiBang1: cc.Node,
        HuoChaiBang2: cc.Node,
        HuoChaiBang3: cc.Node,
        HuoChaiBang4: cc.Node,
        HuoChaiBang5: cc.Node,
        HuoChaiBang6: cc.Node,
    },
    //返回现在代表的数字czl
    getNum: function () {
        if (this.HuoChaiBang0.opacity == 255
            && this.HuoChaiBang1.opacity != 255
            && this.HuoChaiBang2.opacity == 255
            && this.HuoChaiBang3.opacity == 255
            && this.HuoChaiBang4.opacity == 255
            && this.HuoChaiBang5.opacity == 255
            && this.HuoChaiBang6.opacity == 255) {
            return 0;
        } else if (this.HuoChaiBang0.opacity != 255
            && this.HuoChaiBang1.opacity != 255
            && this.HuoChaiBang2.opacity != 255
            && this.HuoChaiBang3.opacity != 255
            && this.HuoChaiBang4.opacity != 255
            && this.HuoChaiBang5.opacity == 255
            && this.HuoChaiBang6.opacity == 255) {
            return 1;
        }
        else if (this.HuoChaiBang0.opacity == 255
            && this.HuoChaiBang1.opacity == 255
            && this.HuoChaiBang2.opacity == 255
            && this.HuoChaiBang3.opacity != 255
            && this.HuoChaiBang4.opacity == 255
            && this.HuoChaiBang5.opacity == 255
            && this.HuoChaiBang6.opacity != 255) {
            return 2;
        }
        else if (this.HuoChaiBang0.opacity == 255
            && this.HuoChaiBang1.opacity == 255
            && this.HuoChaiBang2.opacity == 255
            && this.HuoChaiBang3.opacity != 255
            && this.HuoChaiBang4.opacity != 255
            && this.HuoChaiBang5.opacity == 255
            && this.HuoChaiBang6.opacity == 255) {
            return 3;
        }
        else if (this.HuoChaiBang0.opacity != 255
            && this.HuoChaiBang1.opacity == 255
            && this.HuoChaiBang2.opacity != 255
            && this.HuoChaiBang3.opacity == 255
            && this.HuoChaiBang4.opacity != 255
            && this.HuoChaiBang5.opacity == 255
            && this.HuoChaiBang6.opacity == 255) {
            return 4;
        }
        else if (this.HuoChaiBang0.opacity == 255
            && this.HuoChaiBang1.opacity == 255
            && this.HuoChaiBang2.opacity == 255
            && this.HuoChaiBang3.opacity == 255
            && this.HuoChaiBang4.opacity != 255
            && this.HuoChaiBang5.opacity != 255
            && this.HuoChaiBang6.opacity == 255) {
            return 5;
        }
        else if (this.HuoChaiBang0.opacity == 255
            && this.HuoChaiBang1.opacity == 255
            && this.HuoChaiBang2.opacity == 255
            && this.HuoChaiBang3.opacity == 255
            && this.HuoChaiBang4.opacity == 255
            && this.HuoChaiBang5.opacity != 255
            && this.HuoChaiBang6.opacity == 255) {
            return 6;
        }
        else if (this.HuoChaiBang0.opacity == 255
            && this.HuoChaiBang1.opacity != 255
            && this.HuoChaiBang2.opacity != 255
            && this.HuoChaiBang3.opacity != 255
            && this.HuoChaiBang4.opacity != 255
            && this.HuoChaiBang5.opacity == 255
            && this.HuoChaiBang6.opacity == 255) {
            return 7;
        }
        else if (this.HuoChaiBang0.opacity == 255
            && this.HuoChaiBang1.opacity == 255
            && this.HuoChaiBang2.opacity == 255
            && this.HuoChaiBang3.opacity == 255
            && this.HuoChaiBang4.opacity == 255
            && this.HuoChaiBang5.opacity == 255
            && this.HuoChaiBang6.opacity == 255) {
            return 8;
        }
        else if (this.HuoChaiBang0.opacity == 255
            && this.HuoChaiBang1.opacity == 255
            && this.HuoChaiBang2.opacity == 255
            && this.HuoChaiBang3.opacity == 255
            && this.HuoChaiBang4.opacity != 255
            && this.HuoChaiBang5.opacity == 255
            && this.HuoChaiBang6.opacity == 255) {
            return 9;
        }
        else {
            return -1;
        }
    },

    //设置初始化数字czl
    init: function (num) {
        switch (num) {
            case 0://023456

                this.HuoChaiBang0.opacity = 255;
                this.HuoChaiBang1.opacity = 0;
                this.HuoChaiBang2.opacity = 255;
                this.HuoChaiBang3.opacity = 255;
                this.HuoChaiBang4.opacity = 255;
                this.HuoChaiBang5.opacity = 255;
                this.HuoChaiBang6.opacity = 255;
                break;

            case 1://56
                this.HuoChaiBang0.opacity = 0;
                this.HuoChaiBang1.opacity = 0;
                this.HuoChaiBang2.opacity = 0;
                this.HuoChaiBang3.opacity = 0;
                this.HuoChaiBang4.opacity = 0;
                this.HuoChaiBang5.opacity = 255;
                this.HuoChaiBang6.opacity = 255;
                break;
            case 2://01245
                this.HuoChaiBang0.opacity = 255;
                this.HuoChaiBang1.opacity = 255;
                this.HuoChaiBang2.opacity = 255;
                this.HuoChaiBang3.opacity = 0;
                this.HuoChaiBang4.opacity = 255;
                this.HuoChaiBang5.opacity = 255;
                this.HuoChaiBang6.opacity = 0;
                break;
            case 3://01256
                this.HuoChaiBang0.opacity = 255;
                this.HuoChaiBang1.opacity = 255;
                this.HuoChaiBang2.opacity = 255;
                this.HuoChaiBang3.opacity = 0;
                this.HuoChaiBang4.opacity = 0;
                this.HuoChaiBang5.opacity = 255;
                this.HuoChaiBang6.opacity = 255;
                break;
            case 4://1356
                this.HuoChaiBang0.opacity = 0;
                this.HuoChaiBang1.opacity = 255;
                this.HuoChaiBang2.opacity = 0;
                this.HuoChaiBang3.opacity = 255;
                this.HuoChaiBang4.opacity = 0;
                this.HuoChaiBang5.opacity = 255;
                this.HuoChaiBang6.opacity = 255;
                break;
            case 5://01236
                this.HuoChaiBang0.opacity = 255;
                this.HuoChaiBang1.opacity = 255;
                this.HuoChaiBang2.opacity = 255;
                this.HuoChaiBang3.opacity = 255;
                this.HuoChaiBang4.opacity = 0;
                this.HuoChaiBang5.opacity = 0;
                this.HuoChaiBang6.opacity = 255;
                break;
            case 6://012346
                this.HuoChaiBang0.opacity = 255;
                this.HuoChaiBang1.opacity = 255;
                this.HuoChaiBang2.opacity = 255;
                this.HuoChaiBang3.opacity = 255;
                this.HuoChaiBang4.opacity = 255;
                this.HuoChaiBang5.opacity = 0;
                this.HuoChaiBang6.opacity = 255;
                break;
            case 7://056
                this.HuoChaiBang0.opacity = 255;
                this.HuoChaiBang1.opacity = 0;
                this.HuoChaiBang2.opacity = 0;
                this.HuoChaiBang3.opacity = 0;
                this.HuoChaiBang4.opacity = 0;
                this.HuoChaiBang5.opacity = 255;
                this.HuoChaiBang6.opacity = 255;
                break;
            case 8://0123456
                this.HuoChaiBang0.opacity = 255;
                this.HuoChaiBang1.opacity = 255;
                this.HuoChaiBang2.opacity = 255;
                this.HuoChaiBang3.opacity = 255;
                this.HuoChaiBang4.opacity = 255;
                this.HuoChaiBang5.opacity = 255;
                this.HuoChaiBang6.opacity = 255;
                break;
            case 9://012356
                this.HuoChaiBang0.opacity = 255;
                this.HuoChaiBang1.opacity = 255;
                this.HuoChaiBang2.opacity = 255;
                this.HuoChaiBang3.opacity = 255;
                this.HuoChaiBang4.opacity = 0;
                this.HuoChaiBang5.opacity = 255;
                this.HuoChaiBang6.opacity = 255;
                break;
        }
    },
}
);
